// * vite

// 数字类型环境变量
const NumberEnvVars = ['VITE_PORT','VITE_REQUEST_TIMEOUT']

// boolean类型环境变量
const BooleanEvnVars = ['VITE_PORT','VITE_OPEN_BROWSER']

export const assembyEnvVar = (processEnv:Record<string,string>):ViteEnv=>{
    const ret = {} as any
    for(let [key,value] of Object.entries(processEnv)) {
        if(NumberEnvVars.includes(key))ret[key] = Number(value)
        else if(BooleanEvnVars.includes(key)) {
            ret[key] = Boolean(value.toLocaleLowerCase())
        }
        else ret[key] = value
    }
    return ret
}